package com.xht.controller;

import com.xht.domain.ResponseResult;
import com.xht.mapper.LinkMapper;
import com.xht.service.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/link")
public class LinkController {

    @Autowired
    private LinkService linkService;

    @Autowired
    private LinkMapper linkMapper;

    /**
     * （显示）查询所有审核通过的友联
     *
     * @return
     */
    @GetMapping("/getAllLink")
    public ResponseResult getAllLink() {

        return linkService.getAllLink();
    }

    /**
     * test 利用xml来查询数据库数据 返回 link表中的地址信息
     */
    @GetMapping("/testLink")
    public ResponseResult testLink(Long id) {
        return ResponseResult.okResult(linkMapper.selectById(id));
    }

}
